package com.fr.web;
import java.util.List;
import java.util.Map;
import com.fr.dao.CoachDao;
import com.fr.model.Service;
import net.sf.json.JSONArray;

@SuppressWarnings("serial")
public class GetServiceByCoachId extends JsonServlet {
	@Override
	public String dealInput(Map<String, String[]> input) {
		CoachDao coachDao = new CoachDao();
		int coachId = 1;
//		if(input.get("coachId")!=null && input.get("coachId")[0].matches("\\d{1,9}")) {
			coachId = Integer.parseInt(input.get("coachId")[0]);
//		}
		List<Service> services = coachDao.getServiceByCoachId(coachId);
		System.out.println(JSONArray.fromObject(services));
		return JSONArray.fromObject(services).toString();
	}
}